package com.test.utils.text;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializerFeature;

public class JSONUtils {

    public static String jsonFormat(String jsonString) throws Exception {
        JSONObject jsonObject = JSONObject.parseObject(jsonString);
        return JSON.toJSONString(
                jsonObject,
                SerializerFeature.PrettyFormat,
                SerializerFeature.WriteMapNullValue,
                SerializerFeature.WriteDateUseDateFormat
        );
    }

    public static void main(String[] args) throws Exception {
        System.out.println(JSONUtils.jsonFormat("{'ab':'6789','xx':10}"));
    }
}
